using System;
using System.Collections.Generic;

namespace Skywalker.Web.Mvc.ViewComponents
{
    public class DefaultBuilder<TComponent> : Builder<TComponent, DefaultBuilder<TComponent>> where TComponent : IViewComponent, new() 
    {
        public DefaultBuilder<TComponent> Set(Action<TComponent> setter)
        {
            return SetProperty(setter);
        }

        public DefaultBuilder<TComponent> Add<T>(Func<TComponent, IList<T>> list, T item)
        {
            return AddItem(list, item);
        }

        public DefaultBuilder<TComponent> Add<T, TItemBuilder>(Func<TComponent, IList<T>> list, Action<TItemBuilder> item) where TItemBuilder : IBuilder<T>, new() where T : IViewComponent
        {
            return AddItem(list, item);
        }
    }
}